package com.mycode.facade11.resolve;

import java.io.FileInputStream;

// 文件读取类：子系统类
public class FileReader {

    public String read(String fileNameSrc) {
        System.out.println("读取文件，获取明文：");
        StringBuffer stringBuffer = new StringBuffer();
        try {
            FileInputStream fileInputStream = new FileInputStream(fileNameSrc);
            int data;
            while ((data = fileInputStream.read()) != -1) {
                stringBuffer = stringBuffer.append((char) data);
            }
            fileInputStream.close();
            System.out.println(stringBuffer.toString());
        } catch (Exception e) {
            e.printStackTrace();
        }
        return stringBuffer.toString();
    }
}
